class Comment < ActiveRecord::Base
	belongs_to :page
	
	validates_presence_of :name, :body
	
	def self.recent_comments
	 find(:all, :conditions => ["updated_at >= ?",Time.now - 7.days], :order => "updated_at DESC")
  end
  
  def send_email(page, url_name)

    email = Notifier.create_comment_message(page, self.body, url_name)
    email.set_content_type("text/html")
    Notifier.deliver(email)
  end
end